package com.suven.framework.generator.temp;


/**
 * @Title: dddCodeEnum.java
 * @author suven
 * @date   2019-10-18 12:35:25
 * @version V1.0
 *  <pre>
 * 修改记录
 *    修改后版本:     修改人：  修改日期:     修改内容:
 * </pre>
 * Description:  java ddd 驱动 类型的模块 实现类
 *     //http service项目 adapter
 *     HTTP_FACADE(1,1,"http-xxx-controller","adapter","业务接口实现"),
 *     //后台管理系统
 *     HTTP_CONTROLLER_WEB(2,3,"http-admin-service","admin","后台管理系统"),
 *
 *     //app service + domain //提供内部mvc使用
 *     APP_SERVICE(3,4,"app-xxx-service","app","app-service-domain //提供内部mvc使用"),
 *
 *     //后台sys api
 *     HTTP_VO_PARAMETER(4,2,"api-xxx-vo","parameter","AddRequestVo和ResponseVo"),
 *     //微服务,内部调用 api service项目 app + domain 提供外部spring cloud使用,通过代码实现对外服务
 *     API_SERVICE(5,5,"api-xxx-service","api","Api.java"),
 *
 *     //rpc infrastructure
 *     RPC_INFRASTRUCTURE(6,2,"rpc-xxx-service","infrastructure","infrastructure领域驱动项目"),
 *     //domain 基础公共对象配置
 *     RPC_DTO_DOMAIN(7,2,"domain-xxx-service","domain","RequestDto 请求参数,数据条件查询枚举"),
 *
 *     src/main/java/com/suven/future/sms/
 * ├── domain/                  # 领域层
 * │   ├── model/               # 领域模型
 * │   │   ├── entity/          # 实体 // 领域层实体 - SmsRecord（聚合根） 业务集合对象BO
 * │   │   ├── valueobject/     # 值对象
 * │   │   └── aggregate/       # 聚合
 * │   ├── service/             # 领域服务,领域行为
 * │   └── repository/          # 仓储接口, dao接口
 * ├── app/                    # 应用层 api 实现
 * │   ├── facade/             # 应用服务,相同功能接口
 * │   ├── facade/impl          # 应用服务,相同功能接口实现
 * │   ├── command/             # 命令
 * │   ├── query/               # 查询转换器对象 Bean -> DTO
 * │   └── dto/requestVo       # 数据传输对象
 * │   └── dto/responseVo      # 数据传输对象
 * ├── infrastructure/          # 基础设施层
 * │   ├── repository/          # 仓储实现 dao 实现
 * │   ├── persistence/         # 持久化
 * │   │   ├── entity/          # 持久化实体,表关系对象 PO
 * │   │   └── mapper/          # MyBatis Mapper
 * │   └── external/            # 外部服务
 * │       ├── aliyun/          # 阿里云短信服务
 * │       └── tencent/         # 腾讯云短信服务
 * └── adapter/               # 接口层
 *     ├── rest/                # REST API
 *     ├── facade/              # 外观模式
 *     └── assembler/           # DTO转换器
 *     
 * graph TD
 *     subgraph "接口层 Interface Layer"
 *         C[Controller] --> |使用| DTO[DTO]
 *         C --> |使用| R[Request]
 *         C --> |返回| RES[Response]
 *         C --> |调用| AS[Application Service]
 *     end
 *
 *     subgraph "应用层 Application Layer"
 *         AS --> |协调| DS[Domain Service]
 *         AS --> |使用| DP[Domain Repository Port]
 *         AS --> |转换| DTO
 *     end
 *
 *     subgraph "领域层 Domain Layer"
 *         DS --> |操作| E[Entity]
 *         DS --> |使用| VO[Value Object]
 *         E --> |包含| VO
 *         E --> |实现| DL[Domain Logic]
 *         DS --> |维护| AR[Aggregate Root]
 *         AR --> |管理| E
 *     end
 *
 *     subgraph "基础设施层 Infrastructure Layer"
 *         DRI[Domain Repository Impl] --> |实现| DP
 *         DRI --> |持久化| DB[(Database)]
 *     end
 *
 *     C --> |请求验证| V[Validator]
 *     AS --> |事务管理| TM[Transaction Manager]
 *     DRI --> |ORM映射| ORM[ORM Framework]    
 */


public enum DDDCodeEnum implements CreateCodeEnum{

    // 第一层: http service项目 "接口层 Interface Layer" adapter
    HTTP_CONTROLLER(1,"ddd","/ddd/ddd_controller.java.vm","/controller/","Controller.java"),
    //后台管理系统
    HTTP_CONTROLLER_WEB(1,"ddd","/ddd/ddd_controller_web.java.vm","/controller/","WebController.java"),


    //第二层:"应用层 Application Layer" //接口层使用,和调用领域层 Domain Layer,包括 service 和 Repository的 接口
    //HTTP App service + domain //提供内部mvc使用 组合api,client,infrastructure 业务实现,feinClient
    APP_FACADE(2,"ddd","/ddd/ddd_base_facade.java.vm","/facade/","Facade.java"),
    APP_FACADE_IMPL(2,"ddd","/ddd/ddd_base_facade_impl.java.vm","/facade/impl/","FacadeImpl.java"),
    //与rpc infrastructure平级,依懒domain,将第三方sdk转换自定义对象DTO
    APP_FEIGN_CLIENT(2,"ddd","/ddd/ddd_feign_client.java.vm","/feign/","FeignClient.java"),


    //后台sys api http 相关请求接口入参和返回参数对象
    HTTP_VO_REQUEST_ADD(2,"ddd","/ddd/ddd_base_request_add_vo.java.vm","/vo/request/","AddRequestVo.java",1),
    HTTP_VO_REQUEST_QUERY(2,"ddd","/ddd/ddd_base_request_query_vo.java.vm","/vo/request/","QueryRequestVo.java",1),
    HTTP_VO_RESPONSE_SHOW(2,"ddd","/ddd/ddd_base_response_show_vo.java.vm","/vo/response/","ShowResponseVo.java",1),
    //外面前端业务接口api
    HTTP_VO_REQUEST(2,"ddd","/ddd/ddd_base_request_vo.java.vm","/vo/request/","RequestVo.java",1),
    HTTP_VO_RESPONSE(2,"ddd","/ddd/ddd_base_response_vo.java.vm","/vo/response/","ResponseVo.java",1),



    //第三层:"领域层 Domain Layer" ,包括 service ,ServiceImpl, 业务使用的统合实体对象Entity 和 Repository的 接口
    //微服务,内部调用 api service项目 app + domain 提供外部spring cloud使用,通过代码实现对外服务
    DOMAIN_SERVICE(3,"ddd","/ddd/ddd_service.java.vm","/service/","Service.java"),
    DOMAIN_SERVICE_IMPL(3,"ddd","/ddd/ddd_service_impl.java.vm","/service/impl/","ServiceImpl.java"),
    DOMAIN_API(3,"ddd","/ddd/ddd_api.java.vm","/api/","Api.java"),
    DOMAIN_REPOSITORY(3,"ddd","/ddd/ddd_entity_repository.java.vm","/repository/","Repository.java"),

    //domain 基础公共对象配置
    DOMAIN_DTO_QUERY_ENUM(3,"ddd","/ddd/ddd_query_enum.java.vm","/dto/enums/","QueryEnum.java"),
    DOMAIN_DTO_REQUEST(3,"ddd","/ddd/ddd_base_request_dto.java.vm","/dto/request/","RequestDto.java",1),
    DOMAIN_DTO_RESPONSE(3,"ddd","/ddd/ddd_base_response_dto.java.vm","/dto/response/","ResponseDto.java",1),
    DOMAIN_DTO_ENTITY(3,"ddd","/ddd/ddd_base_entity_bo.java.vm","/dto/entity/","EntityBO.java",1),

    //第四层:"基础设施层 Infrastructure Layer" ,包括 Repository的 持久化实现,Repository的 持久化接口,Repository的 配置,Repository的 缓存实现,Repository的


    //rpc infrastructure
    INF_MODEL(4,"ddd","/ddd/ddd_entity.java.vm","/entity/",".java",1),
    INF_MAPPER(4,"ddd","/ddd/ddd_mapper.java.vm","/mapper/","Mapper.java"),
    INF_MAPPER_XML(4,"ddd","/ddd/ddd_mapper.xml.vm","/mapper/","Mapper.xml"),
//    RPC_CACHE_DAO(7,"ddd","/ddd/ddd_entity_cache_dao.java.vm","/repository/","Dao.java"),
    INF_ENTITY_REPOSITORY_IMPL(4,"ddd","/ddd/ddd_entity_repository_impl.java.vm","/repository/impl/","RepositoryImpl.java"),
//    RPC_SERVICE_IMPL(1,"ddd_service_impl.java.vm","/service/","ServiceImpl.java"),




    ;

    private int index;
    private String type;
    private String temp;
    private String path;
    private String ext;
    private int isWrite;

    DDDCodeEnum(int index, String type, String temp, String path, String extName){
        this.index = index;
        this.type = type;
        this.temp = temp;
        this.path = path;
        this.ext = extName;
    }
    DDDCodeEnum(int index, String type, String temp, String path, String extName, int isWrite){
        this.index = index;
        this.type = type;
        this.temp = temp;
        this.path = path;
        this.ext = extName;
        this.isWrite = isWrite;
    }
//    private static Map<String, dddCodeEnum> typeMap = new HashMap<>();
//    static {
//
//        for(dddCodeEnum type : values()) {
//            typeMap.put(type.getTemp(), type);
//        }
//    }
//    public static dddCodeEnum  getEnum(String tem) {
//        return typeMap.get(tem);
//    }


    @Override
    public String getType() {
        return type;
    }

    public String getTemp() {
        return temp;
    }

    public String getPath() {
        return path;
    }

    public String getExt() {
        return ext;
    }

    public int getIndex(){
        return index;
    }

    public  int isWrite(){ return isWrite;}
}
